﻿/********************************************Globe***********************************************************/
if(typeof jQuery!="undefined")
jQuery(document).ready(function(){
//------------page load-------------

        //init TabControl
       InitTabControl();
       
       //region init formValidator
      //jQuery.formValidator.initConfig({alertMessage:true},'1');// init formValidator
        //endregion
      
//----------------------------------
})

function InitTabControl(){
  //region init TabControl
                if(jQuery('#container_1_selectedIndex').size()>0&&jQuery("#"+jQuery('#container_1_selectedIndex')[0].title).size()>0)
                {
                    //get currentSelectIndex
                    var container_1_selectIndex=parseInt(jQuery("#"+jQuery('#container_1_selectedIndex')[0].title)[0].value,10);
                    if(typeof GetCustomerTab1Index!='undefined'){//if developer assign to customerTab1 index then perform the entry
                        container_1_selectIndex=GetCustomerTab1Index();
                    }
                    //init
                    jQuery('#container-1 ul').tabs({selected:container_1_selectIndex,fx:{opacity:'toggle'}}).
                    bind('select.ui-tabs', function(e, ui){
                        //assign current SelectIndex to HiddenField
                        jQuery("#"+jQuery('#container_1_selectedIndex')[0].title)[0].value=
                        ui.panel.id.substr(ui.panel.id.length-1,1);
                    });
                   //display li
                    jQuery("#container-1")[0].style.display='';
                }
                 
        
                if(jQuery('#container_2_selectedIndex').size()>0&&jQuery("#"+jQuery('#container_2_selectedIndex')[0].title).size()>0)
                {
                    //get currentSelectIndex
                    var container_2_selectIndex=parseInt(jQuery("#"+jQuery('#container_2_selectedIndex')[0].title)[0].value,10);
                    if(typeof GetCustomerTab2Index!='undefined'){//if developer assign to customerTab1 index then perform the entry
                        container_2_selectIndex=GetCustomerTab2Index();
                    }
                    //init
                    jQuery('#container-2 > ul').tabs({selected:container_2_selectIndex,fx:{opacity:'toggle'}}).
                    bind('select.ui-tabs', function(e, ui){
                           //assign current SelectIndex to HiddenField
                           jQuery("#"+jQuery('#container_2_selectedIndex')[0].title)[0].value=
                           ui.panel.id.substr(ui.panel.id.length-1,1);
                    });
                    //display li
                    jQuery("#container-2")[0].style.display='';
                 }
}


//=====================
//=====================
//=====================
function button1out(o)
{
	o.style.background = "URL(images/1buttonout.gif)";
}
function button1over(o)
{
	o.style.background = "URL(images/1buttonover.gif)";
}
//=====================

function helpout(o)
{
	o.style.background = "URL(images/retraction1.gif)";
}
function helpover(o)
{
	o.style.background = "URL(images/retraction2.gif)";
}
//=====================

function exitout(o)
{
	o.style.background = "URL(images/exit1.gif)";
}
function exitover(o)
{
	o.style.background = "URL(images/exit2.gif)";
}
//=====================

function button2out(o)
{
    if (o.value != secondID) {
	    o.style.background = "URL(images/mainleftbuttonout.gif)";
	    o.style.color = "#383838";
	}
}

function button2over(o)
{
	o.style.background = "URL(images/mainleftbuttonover.gif)";
	o.style.color = "#ffffff";
}

function popbuttonout(o)
{
    if (o.value != thirdID) 
    {
	    o.style.background = "URL(images/mainleftbutton.gif)";
	    o.style.color = "#000000";
	}
}
function popbuttonover(o)
{
	o.style.background = "URL(images/mainleftbuttdown.gif)";
	o.style.color = "#ffffff";
}

<!--
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
//-->
function divbuttonout(o)
{
	o.style.background = "#226a9c";
	o.style.color = "#ffffff";
	o.style.fontWeight = "100";
//	o.parentElement.parentElement.style.display = "none";
}

function divbuttonover(o)
{
	o.style.background = "URL(images/3buttonover.gif)";
	o.style.color = "#ffffff";
	o.style.fontWeight = "bold";
}



var container;
var content1;
var content2;
var speed=1000; //滚动速度，值越大越慢
var isup = false;
var MyMar;
function MarqueeMoveOver(moveid, sender, state) {
    var container = document.getElementById("divContainer" + moveid.toString());
    var content1 = document.getElementById("divContent1" + moveid.toString());
    var content2 = document.getElementById("divContent2" + moveid.toString());
    
    this.container = container;
    this.content1 = content1;
    this.content2 = content2;
    if (state == 1) {
        this.isup = true;
    } else {
        this.isup = false; 
    }
    this.MyMar=setInterval(MarqueeDiv1, this.speed);
}

function MarqueeOut(){
    clearInterval(MyMar);
}

function MarqueeDiv1() {
    
    if (content2.offsetTop - container.scrollTop <= 0) {
        container.scrollTop -= content1.offsetHeight;
    } else {
        if (isup) {
            container.scrollTop = container.scrollTop - 1;  //3表示一次移动的象素
        } else {
            this.content1.style.overflow = "";
            this.content1.style.height6 = "";
            container.scrollTop = container.scrollTop + 1;  //3表示一次移动的象素
        }
    }
}    

//----------------------------------------------------
/*******************************************************************************************************/

// 格式化为Money类型

        function FormatAsMoney(mnt) {

            if (isNaN(mnt))

                return 0.00;

            mnt -= 0;

            mnt = (Math.round(mnt*100))/100;

            return (mnt == Math.floor(mnt)) ? mnt + '.00' 

                      : ( (mnt*10 == Math.floor(mnt*10)) ? 

                               mnt + '0' : mnt);

        }
//------------------------------------------------------------------------

//ljj get querystring
function QueryString(fieldName){ 
      var urlString = document.location.search;
      if(urlString != null)
      {
           var typeQu = fieldName+"=";
           var urlEnd = urlString.indexOf(typeQu);
           if(urlEnd != -1)
           {
                var paramsUrl = urlString.substring(urlEnd+typeQu.length);
                var isEnd = paramsUrl.indexOf('&');
                if(isEnd != -1)
                {
                     return paramsUrl.substring(0, isEnd);
                }
                else
                {
                    return paramsUrl;
                }
           }
           else 
           return null;
      }
     else
     return null;
}
 
 function openwindow(url,name,iWidth,iHeight)
 {
  var url;                                 //转向网页的地址;
  var name;                           //网页名称，可为空;
  var iWidth;                          //弹出窗口的宽度;
  var iHeight;                        //弹出窗口的高度;
  var iTop = (window.screen.availHeight-30-iHeight)/2;       //获得窗口的垂直位置;
  var iLeft = (window.screen.availWidth-10-iWidth)/2;           //获得窗口的水平位置;
  window.open(url,name,'height='+iHeight+',,innerHeight='+iHeight+',width='+iWidth+',innerWidth='+iWidth+',top='+iTop+',left='+iLeft+',toolbar=no,menubar=no,scrollbars=yes,resizable=yes,location=no,status=no');
  event.returnValue=false;
 }
 
  function openwindow(url)
 {
  //var url;                                 //转向网页的地址;
  var name="";                           //网页名称，可为空;
  var iWidth=800;                          //弹出窗口的宽度;
  var iHeight=600;                        //弹出窗口的高度;
  var iTop = (window.screen.availHeight-30-iHeight)/2;       //获得窗口的垂直位置;
  var iLeft = (window.screen.availWidth-10-iWidth)/2;           //获得窗口的水平位置;
  window.open(url,name,'height='+iHeight+',,innerHeight='+iHeight+',width='+iWidth+',innerWidth='+iWidth+',top='+iTop+',left='+iLeft+',toolbar=no,menubar=no,scrollbars=yes,resizable=yes,location=no,status=no');
  event.returnValue=false;
 }

 

 //小写转大写
  function Arabia_to_Chinese(Num) {
                for (i = Num.length - 1; i >= 0; i--) {
                    Num = Num.replace(",", "")//替换tomoney()中的“,”
                    Num = Num.replace(" ", "")//替换tomoney()中的空格
                }
                Num = Num.replace("￥", "")//替换掉可能出现的￥字符
                if (isNaN(Num)) { //验证输入的字符是否为数字
                    alert("请检查小写金额是否正确");
                    return;
                }
                //---字符处理完毕，开始转换，转换采用前后两部分分别转换---//
                part = String(Num).split(".");
                newchar = "";
                //小数点前进行转化
                for (i = part[0].length - 1; i >= 0; i--) {
                    if (part[0].length > 10) { alert("位数过大，无法计算"); return ""; } //若数量超过拾亿单位，提示
                    tmpnewchar = ""
                    perchar = part[0].charAt(i);
                    switch (perchar) {
                        case "0": tmpnewchar = "零" + tmpnewchar; break;
                        case "1": tmpnewchar = "壹" + tmpnewchar; break;
                        case "2": tmpnewchar = "贰" + tmpnewchar; break;
                        case "3": tmpnewchar = "叁" + tmpnewchar; break;
                        case "4": tmpnewchar = "肆" + tmpnewchar; break;
                        case "5": tmpnewchar = "伍" + tmpnewchar; break;
                        case "6": tmpnewchar = "陆" + tmpnewchar; break;
                        case "7": tmpnewchar = "柒" + tmpnewchar; break;
                        case "8": tmpnewchar = "捌" + tmpnewchar; break;
                        case "9": tmpnewchar = "玖" + tmpnewchar; break;
                    }
                    switch (part[0].length - i - 1) {
                        case 0: tmpnewchar = tmpnewchar + "元"; break;
                        case 1: if (perchar != 0) tmpnewchar = tmpnewchar + "拾"; break;
                        case 2: if (perchar != 0) tmpnewchar = tmpnewchar + "佰"; break;
                        case 3: if (perchar != 0) tmpnewchar = tmpnewchar + "仟"; break;
                        case 4: tmpnewchar = tmpnewchar + "万"; break;
                        case 5: if (perchar != 0) tmpnewchar = tmpnewchar + "拾"; break;
                        case 6: if (perchar != 0) tmpnewchar = tmpnewchar + "佰"; break;
                        case 7: if (perchar != 0) tmpnewchar = tmpnewchar + "仟"; break;
                        case 8: tmpnewchar = tmpnewchar + "亿"; break;
                        case 9: tmpnewchar = tmpnewchar + "拾"; break;
                    }
                    newchar = tmpnewchar + newchar;
                }
                //小数点之后进行转化
                if (Num.indexOf(".") != -1) {
                    if (part[1].length > 2) {
                        alert("小数点之后只能保留两位,系统将自动截段");
                        part[1] = part[1].substr(0, 2)
                    }
                    for (i = 0; i < part[1].length; i++) {
                        tmpnewchar = ""
                        perchar = part[1].charAt(i)
                        switch (perchar) {
                            case "0": tmpnewchar = "零" + tmpnewchar; break;
                            case "1": tmpnewchar = "壹" + tmpnewchar; break;
                            case "2": tmpnewchar = "贰" + tmpnewchar; break;
                            case "3": tmpnewchar = "叁" + tmpnewchar; break;
                            case "4": tmpnewchar = "肆" + tmpnewchar; break;
                            case "5": tmpnewchar = "伍" + tmpnewchar; break;
                            case "6": tmpnewchar = "陆" + tmpnewchar; break;
                            case "7": tmpnewchar = "柒" + tmpnewchar; break;
                            case "8": tmpnewchar = "捌" + tmpnewchar; break;
                            case "9": tmpnewchar = "玖" + tmpnewchar; break;
                        }
                        if (i == 0) tmpnewchar = tmpnewchar + "角";
                        if (i == 1) tmpnewchar = tmpnewchar + "分";
                        newchar = newchar + tmpnewchar;
                    }
                }
                //替换所有无用汉字
                while (newchar.search("零零") != -1)
                    newchar = newchar.replace("零零", "零");
                newchar = newchar.replace("零亿", "亿");
                newchar = newchar.replace("亿万", "亿");
                newchar = newchar.replace("零万", "万");
                if (newchar != "零元")
                newchar = newchar.replace("零元", "元");
                newchar = newchar.replace("零角", "");
                newchar = newchar.replace("零分", "");
                if (newchar.charAt(newchar.length - 1) == "元" || newchar.charAt(newchar.length - 1) == "角")
                    newchar = newchar + "整"
                //  document.write(newchar);
                return newchar;
            }